<template>
<el-dialog class="check-dialog" :title="checkForm.title" :append-to-body="true" :close-on-click-modal="false" :visible.sync="checkForm.show" width="500px">
    <el-form class="roleCheckDialog">
        <el-form-item label="角色名称：">{{checkForm.form.roleName}}</el-form-item>
        <el-form-item label="角色描述：">{{checkForm.form.remark}}</el-form-item>
        <el-form-item label="创建时间：">{{checkForm.form.createTime}}</el-form-item>
        <el-form-item label="修改时间：">{{checkForm.form.modifyTime}}</el-form-item>
        <el-form-item label="所拥有的权限：">
            <div class="scroll-bar tree-box">
                <el-tree
                    ref="roleTree"
                    :props="labelProp"
                    :data="checkForm.treeData"
                    node-key="id"
                    show-checkbox>
                </el-tree>
            </div>
        </el-form-item>
    </el-form>
</el-dialog>
</template>

<script>
export default {
    name: 'CheckDialog',
    props: {
        checkForm: {
            type: Object,
            required: true
        }
    },
    data () {
        return {
            labelProp: {
                label: 'title',
                disabled: () => {
                    return true
                }
            }
        }
    },
    mounted () {
        this.$nextTick(() => {
            this.$get(`/role/menu/${this.checkForm.form.roleId}`).then(res => {
                if (res) {
                    this.$refs.roleTree.setCheckedKeys(res)
                }
            })
        })
    }
}
</script>

<style lang="less">
.check-dialog {
    .roleCheckDialog {
        width: 100%;
    }
}
</style>
